package com.gmq.chapter01.interrupt;

/**
 * Created by gmq on 2017/08/09.
 *
 * @version 1.0
 * @since 2017/08/09 14:56
 */
public class Run02 {

    public static void main(String[] args) {
//        Thread.currentThread().interrupt();
        // 中断main线程(interrupted具有清除状态的功能，第一次是true，第二次是false)
//        System.out.println(" 是否停止 1 ？ =" + Thread.interrupted());
//        System.out.println(" 是否停止 2 ？ =" + Thread.interrupted());
//        System.out.println(" end! ");

        try {
            MyThread02 thread = new MyThread02();
            thread.start();
            Thread.sleep(2000);
            thread.interrupt();
        } catch (InterruptedException e) {
            System.out.println("main catch");
            e.printStackTrace();
        }
        System.out.println("end!");
    }
}
